#!/usr/bin/python
#coding=utf-8

import sys;
dp = [-1] * 2005
dp[0] = 0;
ans = 0;
for i in xrange(int(raw_input())):
		s, x = raw_input().split();
		x = int(x);
		if s[0] == 'w':
			dp[x] = max(dp[x], ans);
		else:
			if dp[x] != -1:
				ans = max(ans, dp[x] + 2**x);

print ans;
